package mtm.db;

import java.io.Serializable;

import mtm.date.MtmDate;

public class RepeatJob extends AbstractJob {
	
	public static final int DATE_LOOP = 1;
	public static final int WEEK_LOOP = 7;
	public static final int MONTH_LOOP = 0;
	public static final int YEAR_LOOP = -1;
	
	private int pause;
	private int elapse = 1;
	private MtmDate dueTime;
	
	
	/**
	 * Constructor
	 */
	public RepeatJob() {
		
	}
	
	
	/**
	 * Constructor
	 */
	public RepeatJob(String jobName, MtmDate startTime, MtmDate endTime, 
			String description, int pause, MtmDate dueTime) {
		super(jobName, startTime, endTime, description);
		this.pause = pause;
		this.dueTime = dueTime;
	}
	
	
	/**
	 * Constructor
	 */
	public RepeatJob(String jobName, MtmDate startTime, MtmDate endTime, 
			String description, int pause, MtmDate dueTime, int elapse) {
		this(jobName, startTime, endTime, description, pause, dueTime);
		this.elapse = elapse;
	}

	
	/**
	 * Constructor
	 */
	public RepeatJob(String jobName, MtmDate startTime, MtmDate endTime, 
			String description, int color,
			int pause, MtmDate dueTime, int elapse) {
		this(jobName, startTime, endTime, description, pause, dueTime);
		this.color = color;
		this.elapse = elapse;
	}
	
	
	/**
	 * Constructor
	 */
	public RepeatJob(String jobName, MtmDate startTime, MtmDate endTime, 
			String description, String icon, int color, int pause, MtmDate dueTime) {
		super(jobName, startTime, endTime, description, icon, color);
		this.pause = pause;
		this.dueTime = dueTime;
	}
	
	
	@Override
	public String toString() {
		return id + ", " + jobName + ", " + startTime.toString() + ", " + endTime.toString() 
				+ ", " + description + ", " + pause + ", " + dueTime != null ? dueTime.toString() : " null due time";
	}
	
	
	/**
	 * Getter and setter method
	 */
	public int getPause() {
		return pause;
	}

	public void setPause(int pause) {
		this.pause = pause;
	}
	
	public int getElapse() {
		return elapse;
	}

	public void setElapse(int elapse) {
		this.elapse = elapse;
	}

	public MtmDate getDueTime() {
		return dueTime;
	}

	public void setDueTime(MtmDate dueTime) {
		this.dueTime = dueTime;
	}
}
